[R] how do I quickly group the time column in a dataframe into intervals?

Posted by Derek on Stack Overflow See other posts from Stack Overflow or by Derek
Published on 2010-05-27T18:08:30Z Indexed on 2010/05/27 18:11 UTC
Read the original article Hit count: 179

Filed under:
|

Hi,

Assuming in R, I have a data.frame with the first column representing the time (as POSIXct). The rest of the columns (e.g., columns 2) are numeric data.

I would like to group time into 3-minute intervals. Each interval will the the average of values that falls into that particular interval.

Right now, I have a for-loop that iterates through the time column and generate the interval on the fly. I am wondering if there's a more elegant way to accomplish the same thing?

Thanks in advance.

Derek

© Stack Overflow or respective owner

Related posts about r

    Related posts about cran